#pragma once

#include "afxinet.h"
#include "ftp.h"
#include "singletonTemplate.h"
#include "IFtpNotifier.h"
#include "MyInternetSession.h"

class CFtpEx :
	public CFtp
{
public:
	friend class CSingleton<CFtpEx>;

	CFtpEx(void);
	~CFtpEx(void);

public:

	virtual bool Initialize(TCHAR* pHost, TCHAR* pUser, TCHAR* pPwd, UINT32 nPort, UINT32 nIndex);
	virtual bool MakeDirectory(TCHAR strDirectory[MAX_PATH]);
	virtual bool IsFileExist(TCHAR strFilePath[MAX_PATH]);
	virtual bool UploadFile(TCHAR szLocalFile[MAX_PATH], TCHAR szRemoteFile[MAX_PATH]);
	virtual bool DownloadFile(TCHAR szRemoteFile[MAX_PATH], TCHAR szLocalFile[MAX_PATH],int iTimeOut = 0);
	virtual bool Login();
	virtual bool Logout();
	virtual bool IsConnected();
	virtual bool DisConnect();
	virtual bool ReCreateConnect();


protected:

	CMyInternetSession	m_session;
	CFtpConnection*		m_pFTPConnection;
	CRITICAL_SECTION	m_cs;
	// HANDLE				m_hUploadFile;
};

